package com.woniuxy.kaer.gateway.swagger;

import org.springframework.stereotype.Component;
import springfox.documentation.swagger.web.SwaggerResource;
import springfox.documentation.swagger.web.SwaggerResourcesProvider;

import java.util.Arrays;
import java.util.List;

@Component
public class SwaggerResourceList  implements SwaggerResourcesProvider {
    /**
     * 下拉列表里面的资源列表配置
     */
    @Override
    public List<SwaggerResource> get() {
        return Arrays.asList(
                createResource("/shop/v2/api-docs","商城服务"),//此处的shop是shop-server服务的请求地址前缀
                createResource("/service/v2/api-docs","服务模块"),
                createResource("/user/v2/api-docs","用户服务"),
                createResource("/system/v2/api-docs","系统服务"),
                createResource("/tenants/v2/api-docs","商户服务")

        );
    }

    private SwaggerResource createResource(String url,String name) {
        SwaggerResource sr = new SwaggerResource();
        sr.setLocation(url);
        sr.setName(name);
        sr.setSwaggerVersion("2.0");
        return sr;
    }
}
